<!DOCTYPE html>
<html>
<head>
    {% load static %}
    <meta charset="utf-8">
    <title>角色列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/lib/layui/css/layui.css">
    <link rel="stylesheet" href="{% static '/lib/fonts/iconfont.css' %}">
    <link rel="stylesheet" href="/static/css/oksub.css">
	<link rel="stylesheet" href="/static/lib/layui/css/global.css">
    <script type="text/javascript" src="/static/lib/loading/okLoading.js"></script>
</head>
<body>
<div class="ok-body">
    {% csrf_token %}
    <blockquote class="layui-elem-quote">系统管理>日志管理>登录日志管理</blockquote>
    <!--数据表格-->
    <table class="layui-hide" id="tableId" lay-filter="tableFilter"></table>
</div>
<!--js逻辑-->
<script src="/static/lib/layui/layui.js"></script>
<script>
    layui.use(["element", "jquery", "table", "form", "laydate", "okLayer", "okUtils", "okMock"], function () {
        let table = layui.table;
        let form = layui.form;
        let laydate = layui.laydate;
        let okLayer = layui.okLayer;
        let okUtils = layui.okUtils;
        let okMock = layui.okMock;
        let $ = layui.jquery;
        okLoading.close($);


        let userTable = table.render({
            elem: '#tableId',
            url: '{% url "system:getLoginLogData" %}',
            limit: 20,
            height: 'full-100',
            page: true,
            toolbar: "#toolbarTpl",
            size: "sm",
            cols: [[
                {type: "checkbox", fixed: "left"},
                {field: "id", title: "ID", width: 60, sort: true},
                {field: "login_type", title: "登录方式", width: 100,templet: "#typeTpl"},
                {field: "username", title: "登录用户", width: 150},
                {field: "create_datetime", title: "登录时间", width: 200},
                {field: "ip", title: "IP地址", width: 100},
                {field: "agent", title: "agent信息", width: 200},
				{field: "browser", title: "浏览器名", width: 150},
                {field: "os", title: "操作系统", width: 200},
                
            ]],
            done: function (res, curr, count) {

            }
        });
        });
</script>


<script type="text/html" id="typeTpl">
    {% verbatim %}
    {{#  if(d.login_type == 1){ }}
    <span class="layui-btn layui-btn-xs">普通登录</span>
    {{#  } else if(d.login_type == 2) { }}
    <span class="layui-btn layui-btn-danger layui-btn-xs">扫码登录</span>
    {{#  } }}
    {% endverbatim %}
</script>
</body>
</html>
